package com.gofun.framework.dubbo.core.environment.config;

import com.gofun.framework.dubbo.core.environment.ConfigMapping;
import com.gofun.framework.dubbo.core.environment.ResolveMappingStrategy;
import com.gofun.framework.dubbo.core.environment.DefaultResolveStrategy.ResolveStrategyEnum;

/**
 * @Project       : framework-dubbo-core
 * @Program Name  : com.ljt.framework.dubbo.core.environment.property.MethodConfigEnum.java
 * @Description   : <dubbo:method/> 方法级配置
 * @Author        : wangchao
 * @Creation Date : 2016年5月27日 下午4:04:50 
 * @ModificationHistory  
 * Who          When             What 
 * ----------   -------------    -----------------------------------
 * wangchao     2016年5月27日        create
 */
public enum MethodConfigEnum implements ConfigMapping {
	
	NAME("dubbo.method.name","方法名"),
	
	TIMEOUT("dubbo.method.timeout","方法调用超时时间(毫秒),默认1000"),
	
	;
	
	public String code;
	
	public String text;
	
	public String[] activated; 
	
	public ResolveMappingStrategy resolveMapping;
	
	private MethodConfigEnum(String code,String text) {
		this(code, text,ResolveStrategyEnum.DIRECT.resolve, ALL_ACTIVATED);
	}
	
	private MethodConfigEnum(String code,String text,String... activated) {
		this(code, text, ResolveStrategyEnum.DIRECT.resolve, activated);
	}
	
	private MethodConfigEnum(String code,String text,ResolveMappingStrategy resolveMapping,String... activated) {
		this.code = code;
		this.text = text;
		this.activated = activated;
		this.resolveMapping = resolveMapping;
	}
	
	@Override
	public ResolveMappingStrategy getResolveMapping() {
		return resolveMapping;
	}
	
	public String[] getActivated() {
		return activated;
	}
	
	@Override
	public String getCode() {
		return code;
	}

	@Override
	public String getText() {
		return text;
	}

}
